<%#
    Auth: Wen
    Version: V1.0
    Data: 2019.8.20
    Function:
%>
<%+header%>
<html>
    <head>
    <meta charset="utf-8">
    <title>Wen</title>
    <script type="text/javascript">
    var XHR1 = new XHR();

    function GetAntennaAlarm()
    {
        XHR1.post('<%=controller%>admin/ACU_Antenna/getAntennaAlarm', {token:'<%=token%>', step: '1'}, function(x){

            //对返回的数据进行解析，并填入到相应的控件
            var str = x.responseText;
            var temp = 0;
            var alm = "";
            console.log(str);
            //是否有错误警告
            if(str.match(/Error/g) == null)
            {
                var n = str.split(",");
                temp = parseInt(n[2], 10);
                if((temp & 0x0001) == 0x0001)
                {
                    alm = alm + "<%:#Connect Error:master CPU and polarization CPU#\r\n%>";
                }
                if((temp & 0x0002) == 0x0002)
                {
                    alm =  alm + "<%:#Connect Error:master CPU and master INS#\r\n%>";
                }
                if((temp & 0x0004) == 0x0004)
                {
                    alm =  alm + "<%:#Connect Error:master CPU and azimuth INS#\r\n%>";
                }
                if((temp & 0x0008) == 0x0008)
                {
                    alm =  alm + "<%:#Master CPU Decode Error#\r\n%>";
                }
                if((temp & 0x0010) == 0x0010)
                {
                    alm =  alm + "<%:#Flash Error#\r\n%>";
                }
                if((temp & 0x0020) == 0x0020)
                {
                    alm =  alm + "<%:#Azimuth Motor Error#\r\n%>";
                }
                if((temp & 0x0040) == 0x0040)
                {
                    alm =  alm + "<%:#Pitch Motor Error#\r\n%>";
                }
                if((temp & 0x0080) == 0x0080)
                {
                    alm =  alm + "<%:#Roll Motor Error#\r\n%>";
                }
                if((temp & 0x0100) == 0x0100)
                {
                    alm = alm + "<%:#Azimuth Limit Switch Error#\r\n%>";
                }
                if((temp & 0x0200) == 0x0200)
                {
                    alm = alm + "<%:#Azimuth Motor Encoder Error#\r\n%>";
                }
                if((temp & 0x0400) == 0x0400)
                {
                    alm = alm + "<%:#Pitch Bottom Limit Switch Error#\r\n%>";
                }
                if((temp & 0x0800) == 0x0800)
                {
                    alm = alm + "<%:#Pitch Top Limit Switch Error#\r\n%>";
                }
                if((temp & 0x1000) == 0x1000)
                {
                    alm = alm + "<%:#Pitch Motor Encoder Error#\r\n%>";
                }
                if((temp & 0x2000) == 0x2000)
                {
                    alm = alm + "<%:#Roll Left Limit Switch Error#\r\n%>";
                }
                if((temp & 0x4000) == 0x4000)
                {
                    alm = alm + "<%:#Roll Right Limit Switch Error#\r\n%>";
                }
                if((temp & 0x8000) == 0x8000)
                {
                    alm = alm + "<%:#Roll Motor Encoder Error#\r\n%>";
                }
                if((temp | 0x0000) == 0x0000)
                {
                    alm = alm + "<%:#No Error#\r\n%>";
                }
                document.getElementById("masterControllerAlarm").innerHTML = alm;

                alm = "";
                temp = parseInt(n[3], 10);
                if((temp & 0x0001) == 0x0001)
                {
                    alm = alm + "<%:#Polarization CPU Decode Error#\r\n%>";
                }
                if((temp & 0x0002) == 0x0002)
                {
                    alm =  alm + "<%:#Optolectronic Device Error#\r\n%>";
                }
                if((temp & 0x0004) == 0x0004)
                {
                    alm =  alm + "<%:#LNB Power Error#\r\n%>";
                }
                if((temp & 0x0008) == 0x0008)
                {
                    alm =  alm + "<%:#Receive From TUNER CPU Error#\r\n%>";
                }
                if((temp & 0x0010) == 0x0010)
                {
                    alm =  alm + "<%:#Polarization Motor Error#\r\n%>";
                }
                if((temp & 0x0020) == 0x0020)
                {
                    alm =  alm + "<%:#Polarization Left Limit Switch Error#\r\n%>";
                }
                if((temp & 0x0040) == 0x0040)
                {
                    alm =  alm + "<%:#Polarization Right Limit Switch Error#\r\n%>";
                }
                if((temp & 0x0080) == 0x0080)
                {
                    alm =  alm + "<%:#Polarization Motor Encoder Error#\r\n%>";
                }
                if((temp & 0x0100) == 0x0100)
                {
                    alm = alm + "<%:#Receive From Master CPU Error#\r\n%>";
                }
                if((temp & 0x0200) == 0x0200)
                {
                    alm = alm + "<%:#TUNER CPU Set Error#\r\n%>";
                }
                if((temp | 0x0000) == 0x0000)
                {
                    alm = alm + "<%:#No Error#\r\n%>";
                }
                document.getElementById("polAlarm").innerHTML = alm;
				
                alm = "";
                temp = parseInt(n[4], 10);
                if((temp & 0x0001) == 0x0001)
                {
                    alm = alm + "<%:#TUNER CPU Decode Error#\r\n%>";
                }
                if((temp & 0x0002) == 0x0002)
                {
                    alm =  alm + "<%:#TUNER CPU IIC Error#\r\n%>";
                }
                if((temp | 0x0000) == 0x0000)
                {
                    alm = alm + "<%:#No Error#\r\n%>";
                }
                document.getElementById("tunerAlarm").innerHTML = alm;
                document.getElementById("pitchCumulativeDesynchronyAngle").innerHTML = n[5] + "&#176";

                alm = "";
                temp = parseInt(n[6], 10);
                if((temp & 0x0001) == 0x0001)
                {
                    alm = alm + "<%:#Azimuth INS Not Calibrated#\r\n%>";
                }
                if((temp & 0x0002) == 0x0002)
                {
                    alm = alm + "<%:#Master INS Not Calibrated#\r\n%>";
                }
                if((temp | 0x0000) == 0x0000)
                {
                    alm = alm + "<%:#No Error#\r\n%>";
                }
                document.getElementById("insCalibrationFlag").innerHTML = alm;

                var y = n[7].split("*");
                temp = parseInt(y[0], 10);

                alm = "";

                if((temp & 0x0001) == 0x0001)
                {
                    alm = alm + "<%:#GPS Error#\r\n%>";
                }
                if((temp & 0x0002) == 0x0002)
                {
                    alm =  alm + "<%:#Temperature And Humidity Sensor Error#\r\n%>";
                }
                if((temp & 0x0004) == 0x0004)
                {
                    alm =  alm + "<%:#CPU Encryption Error#\r\n%>";
                }
                if((temp | 0x0000) == 0x0000)
                {
                    alm = alm + "<%:#No Error#\r\n%>";
                }
                document.getElementById("reserveAlarm").innerHTML = alm; 
                document.getElementById("warmingGetAlarm").innerHTML = "Data:" +n[2]+","+n[3]+","+n[4]+","+n[5]+","+n[6]+","+y[0];
            }
            else
            {
                document.getElementById("warmingGetAlarm").innerHTML = "Title:" + x.responseText;
            }
        })
    }
    </script>
    </head>
    <body>
        <p style="color:red;" id="warmingGetAlarm"></p>
        <fieldset class="cbi-section">
        <div class="widget-box">
            <div class="widget-title">
                <span class="icon">
                <i class="icon-align-justify"></i>
                </span>
                <h5><%:Antenna Alarm%></h5>
            </div>
            <div class="widget-content nopadding">
                <table width="100%" cellspacing="10">
                    <tr><td width="33%"><%:Master Controller Alarm%></td><td id="masterControllerAlarm"></td></tr>
                    <tr><td width="33%"><%:Pol Alarm%></td><td id="polAlarm"></td></tr>
                    <tr><td width="33%"><%:Tuner Alarm%></td><td id="tunerAlarm"></td></tr>
                    <tr><td width="33%"><%:Pitch Cumulative Desynchrony Angle%></td><td id="pitchCumulativeDesynchronyAngle"></td></tr>
                    <tr><td width="33%"><%:INS Calibration Flag%></td><td id="insCalibrationFlag"></td></tr>
                    <tr><td width="33%"><%:Reserve Alarm%></td><td id="reserveAlarm"></td></tr>
                </table>
                <script>
                    GetAntennaAlarm();
                </script>
            </div>
        </div>
        </fieldset>
    </body>
</html>
<%+footer%>